<template>
  <div class="selects">
    <div class="curr" @click="closeCurr">
      <div class="sheng">{{ treeData.name }}</div>
      <span class="pull"></span>
    </div>
    <span class="border-bottom"></span>
    <ul id="demo">
      <tree-item class="item" :item="treeData"></tree-item>
    </ul>
  </div>
</template>

<script>
import TreeItem from "./TreeItem.vue";
import { tree } from "network/ksh";

export default {
  components: { TreeItem },
  data() {
    return {
      treeData: {},
    };
  },
  created() {
    this.treeFun();
  },
  methods: {
    async treeFun() {
      let res = await tree();
      this.treeData = res.result[0];
    },
    closeCurr() {
      this.$emit('close-curr')
    },
  },
};
</script>

<style lang="scss" scoped>
.curr {
  color: #fff;
  font-size: 1.25rem;
  width: 100%;
  line-height: 1.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .sheng {
    padding-left: 3.125rem;
    background: url(~assets/img/ksh/map.png) no-repeat center left;
    background-size: 1.25rem 1.3125rem;
  }
  .pull {
    display: inline-block;
    width: 0.6875rem;
    height: 0.375rem;
    background: url(~assets/img/ksh/pull2.png) no-repeat;
    background-size: 100% 100%;
  }
}

.border-bottom {
  height: 0.3125rem;
  width: 100%;
  background: url(~assets/img/ksh/border.png) no-repeat;
  background-size: 100% 100%;
  display: inline-block;
}
.selects {
  width: 21.875rem;
  background-color: rgba(0, 8, 54, 0.6);
  box-shadow: rgba(0, 5, 202, 0.5) 0rem 0rem 1.875rem inset;
  padding: 1.25rem;
  #demo {
    max-height: 31.25rem;
    overflow: auto;
    .item {
      font-size: 1rem;
      color: #fff;
    }
  }
}
</style>